import { request } from "@/utils/request";


export interface Children {
	id: string;
	pid: string;
	type: number;
	name: string;
	perms: string;
	page_path: string;
	route_path: string;
	icon?: any;
}

export interface Menu_tree {
	id: string;
	pid: string;
	type: number;
	name: string;
	perms: string;
	page_path: string;
	route_path: string;
	icon: string;
	children: Children[];
}

export interface Button_list {
	id: string;
	pid: string;
	type: number;
	name: string;
	perms: string;
	page_path: string;
	route_path: string;
	icon?: any;
}

export interface MENU_TYPE {
	dict_code: string;
	label: string;
	value: number;
}

export interface ACTIVITY_VOTE_RECORD_SERV {
	dict_code: string;
	label: string;
	value: number;
}

export interface CATEGORY_SERV {
	dict_code: string;
	label: string;
	value: number;
}

export interface RESOURCE_FILE_TYPE {
	dict_code: string;
	label: string;
	value: number;
}

export interface ACTIVITY_COLLECT_FILE_TYPE {
	dict_code: string;
	label: string;
	value: number;
}

export interface ROLE_DATA_AUTH {
	dict_code: string;
	label: string;
	value: number;
}

export interface MATERIAL_LIVE_STATU {
	dict_code: string;
	label: string;
	value: number;
}

export interface USER_TYPE {
	dict_code: string;
	label: string;
	value: number;
}

export interface CREATE_SOURCE_TYPE {
	dict_code: string;
	label: string;
	value: number;
}

export interface ACTIVITY_SERV {
	dict_code: string;
	label: string;
	value: number;
}

export interface ACTIVITY_STATU {
	dict_code: string;
	label: string;
	value: number;
}

export interface REQUEST_TYPE {
	dict_code: string;
	label: string;
	value: number;
}

export interface LABEL_SERV {
	dict_code: string;
	label: string;
	value: number;
}

export interface DEPT_TYPE {
	dict_code: string;
	label: string;
	value: number;
}

export interface Dict_data_map {
	mENU_TYPE: MENU_TYPE[];
	aCTIVITY_VOTE_RECORD_SERV: ACTIVITY_VOTE_RECORD_SERV[];
	cATEGORY_SERV: CATEGORY_SERV[];
	rESOURCE_FILE_TYPE: RESOURCE_FILE_TYPE[];
	aCTIVITY_COLLECT_FILE_TYPE: ACTIVITY_COLLECT_FILE_TYPE[];
	rOLE_DATA_AUTH: ROLE_DATA_AUTH[];
	mATERIAL_LIVE_STATUS: MATERIAL_LIVE_STATU[];
	uSER_TYPE: USER_TYPE[];
	cREATE_SOURCE_TYPE: CREATE_SOURCE_TYPE[];
	aCTIVITY_SERV: ACTIVITY_SERV[];
	aCTIVITY_STATUS: ACTIVITY_STATU[];
	rEQUEST_TYPE: REQUEST_TYPE[];
	lABEL_SERV: LABEL_SERV[];
	dEPT_TYPE: DEPT_TYPE[];
}

export interface Route_map {
	temp_root: string;
	attachment_root: string;
}

export interface Upload_map {
	suffix_white_list: string[];
	max_size: string;
	max_num: number;
}

export interface Current_user {
	id: string;
	username: string;
	name: string;
	email: string;
	dept_id: string;
	max_role: string;
}

export interface UserStateType {
	dict_data_map: Partial<Dict_data_map>;
	current_user: Partial<Current_user>;
	menu_tree: Menu_tree[];
	button_list: Button_list[];
	perms_list: string[];
	route_map: Partial<Route_map>;
	upload_map: Partial<Upload_map>;
}

export const login = (data:any) => request<{token:string}>(`/login`, "POST", data, true);

export const LoginData = () => request<UserStateType>(`/logined_data`, "GET");

export const logout = () => request(`/logout`, "POST");